import React,{Component} from "react";
import {Button,Space} from "antd";
import {Popconfirm,message} from "antd";

interface IProps {
    id:number
    callback(id:number):void
}


export default class DeleteUser extends Component<IProps, any>{
    /**
     * 网络请求 删除成功
     */
    deleteUser=() =>{
        this.props.callback(this.props.id)
}

    confirm=() =>{
        this.deleteUser()
    }
    cancel=() =>{
        message.warn("取消删除")
    }
    render(){
        return (
            <div>
                <Popconfirm title="你确定你要删除这项内容吗？"
                            onConfirm={this.confirm}
                            onCancel={this.cancel}
                            okText="Yes"
                            cancelText="No">
                <Button type="primary" danger>删除</Button>
                </Popconfirm>
            </div>
        )
    }
}
